<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简化对象写法</title>
</head>

<body>
    <script>
        let name123 = 'h5220331';
        let total = 97;
        let classNum = '0316';
        let studyCoding = function () {
            console.log('i like coding！');
        }

        let h50331 = {
            name: name123,
            total: total,
            classNum: classNum,
            studyCoding: studyCoding
        }
        console.log(h50331);
        // 如果属性名和变量名一致时，可以简写
        let h = {
            name,
            total,
            classNum,
            studyCoding
        }
        console.log(h);

    </script>
</body>

</html>